
  <!-- <div>历史记录查询</div> -->
<template>
  <BaseMainSlot>
    <template v-slot:search-box>
      <SearchForm
        :formConfig="formConfig"
        :formData="searchlist"
        @search="search"
      ></SearchForm>
    </template>
    <template v-slot:btn-box>
      <SelectButton
        :buttonselectlist="selectbutlist"
        @nowselectbuttonindex="gettabletype"
      />
      <ActionBar
        :page-no="32"
        :has-add="false"
        :has-del="false"
        :has-edit="false"
        :has-cancel="false"
        :has-edit-column="true"
        :has-export="true"
        @download="download"
        @showColumn="showColumn"
      />
    </template>
    <template v-slot:table-box>
      <Table
        @sortChange="changeTableSort"
        :propList="tableColumn"
        v-loading="loading"
        :listData="tableData"
        :showSelectColumn="false"
        @handleSelectionChange="handleSelectionChange"
      >
        <template v-slot:operation="{ row }">
          <template v-if="!row.index && row.agriculturalTaskId">
            <el-button
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="
                row.taskType === '分发任务' ? distribute(row) : operation(row)
              "
            >
              查看详细信息
            </el-button>
          </template>
        </template>
        <template v-slot:facilityBOList="{ row }">
          <template v-if="!row.index && row.agriculturalTaskId">
            <el-button
              class="text-btn-cursor"
              type="text"
              size="small"
              @click="seeEquip(row)"
            >
              <i class="el-icon-view"></i> 查看
            </el-button>
          </template>
        </template>
        <template v-slot:execStartTime="{ row }">
          <template v-if="!row.index && row.agriculturalTaskId">
            {{ row.execStartTime }} - {{ row.execEndTime }}
          </template>
        </template>
      </Table>
      <Pagination
        :page-size="pageSize"
        :current-page="currentPage"
        :total-size="totalSize"
        @changePageSize="changePageSize"
        @changeCurrentPage="changeCurrentPage"
      />
    </template>
    <template v-slot:dialog>
      <!-- 临时任务弹出框信息 -->
      <el-dialog
        title="任务详细信息"
        :visible.sync="operationVisible"
        width="60%"
        ><el-form
          label-position="left"
          :model="formData"
          :rules="rules"
          class="el-form"
        >
          <el-form-item
            label="农事作业信息："
            prop="agriculturalWorkTypeName"
            class="w50p"
          >
            <el-input
              v-if="formData.agriculturalWorkType !== undefined"
              v-model="formData.agriculturalWorkType.agriculturalWorkTypeName"
              disabled
            />
          </el-form-item>
          <!-- <el-form-item label="作业方式：" prop="method" class="w50p">
            <el-input v-model="formData.method" />
          </el-form-item> -->
          <el-form-item label="批次名称：" prop="batchName" class="w50p">
            <el-input v-model="formData.batchName" disabled />
          </el-form-item>
          <el-form-item label="批次号：" prop="batchNo" class="w50p">
            <el-input v-model="formData.batchNo" disabled />
          </el-form-item>

          <el-form-item label="设施名称：" prop="facilityName" class="w50p">
            <el-input
              v-for="(item, index) in formData.facilityBOList"
              :key="index"
              v-model="item.facilityName"
              disabled
            />
          </el-form-item>
          <el-form-item label="作业量：" prop="workload" class="w50p">
            <el-input
              v-model="formData.workload"
              placeholder="请输入作业量"
              clearable
              disabled
              ><template slot="append">
                {{ formData.workloadUnitName }}
              </template>
            </el-input>
          </el-form-item>
          <!-- <el-form-item label="作业量单位：" prop="workloadUnitNo" class="w50p">
           <el-select v-model="formData.workloadUnitNo" disabled clearable>
             <el-option
               v-for="item in unitlist"
               :key="item.unitNo"
               :label="item.unitName"
               :value="item.unitNo"
             />
           </el-select>
         </el-form-item> -->
          <el-form-item
            label="任务执行时间："
            prop="execStartTime"
            class="w50p"
          >
            <el-date-picker
              v-model="formData.execStartTime"
              class="w50p"
              style="width: 50%"
              type="datetime"
              disabled
            />
            <el-date-picker
              v-model="formData.execEndTime"
              class="w50p"
              style="width: 50%"
              type="datetime"
              disabled
            />
          </el-form-item>
          <el-form-item label="作业结果（备注）：" prop="remark" class="w50p">
            <el-input v-model="formData.remark" autosize disabled />
          </el-form-item>
        </el-form>
        <div class="inputs-list-two">
          <!-- 投入记录项 -->
          <div class="title w100p">投入物资</div>
          <div
            v-for="(item, index) in inputsRecordBOList"
            :key="index"
            class="input-item w100p"
          >
            <div class="input-item-line w50p">
              <div class="lable">投入日期：</div>
              <div class="value">
                <el-date-picker
                  v-model="item.assetDate"
                  type="datetime"
                  disabled
                  placeholder="请选择投入日期"
                />
              </div>
            </div>
            <div class="input-item-line w50p">
              <div class="lable">投入农资名称：</div>
              <div class="value">
                <el-input v-model="item.materialDTO.materialName" disabled />
              </div>
            </div>
            <div class="input-item-line w50p">
              <div class="lable">投入量：</div>
              <div class="value">
                <el-input v-model="item.assetQuantity" disabled
                  ><template slot="append">
                    {{ item.unitName }}
                  </template></el-input
                >
              </div>
            </div>
            <!-- <div class="input-item-line w50p">
              <div class="lable">投入量单位：</div>
              <div class="value">
                <el-select v-model="item.unitNo" disabled clearable>
                  <el-option
                    v-for="items in unitlist"
                    :key="items.unitNo"
                    :label="items.unitName"
                    :value="items.unitNo"
                  />
                </el-select>
              </div>
            </div> -->
            <!-- <div class="input-item-line">
              <div class="lable">投入金额:</div>
              <div class="value">
                <el-input v-model="item.assetValue" />
              </div>
            </div> -->
            <div class="input-item-line w50p">
              <div class="lable">经手人：</div>
              <div class="value">
                <el-input v-model="item.personName" disabled />
                <!-- <el-select v-model="item.personNo" disabled clearable>
                  <el-option
                    v-for="(items, indexs) in staffList"
                    :key="indexs"
                    :label="items.name"
                    :value="items.personNo"
                  />
                </el-select> -->
              </div>
            </div>
            <!-- <div class="input-item-line">
              <div class="lable">备注:</div>
              <div class="value">
                <el-input v-model="item.remark" type="textarea" />
              </div>
            </div> -->
          </div>
        </div>
        <!-- <span slot="footer" class="dialog-footer">
          <el-button class="zh-button-one" @click="operationVisible = false">取 消</el-button>
          <el-button class="zh-button-two" type="primary" @click="operationVisible = false">
            确 定
          </el-button>
        </span> -->
      </el-dialog>
      <!-- 分发任务弹出框信息 -->
      <el-dialog
        title="任务详细信息"
        :visible.sync="distributeVisible"
        width="60%"
      >
        <el-form
          ref="formData"
          label-position="left"
          :model="formData"
          :rules="rules"
          class="el-form"
        >
          <el-form-item
            label="农事作业类型:"
            prop="agriculturalWorkTypeName"
            class="w50p"
          >
            <el-input
              v-if="formData.agriculturalWorkType !== undefined"
              v-model="formData.agriculturalWorkType.agriculturalWorkTypeName"
              disabled
            />
          </el-form-item>
          <el-form-item label="作业方式:" prop="method" class="w50p">
            <el-input
              v-if="formData.agriculturalWorkType !== undefined"
              v-model="formData.agriculturalWorkType.method"
              disabled
            />
          </el-form-item>
          <el-form-item label="批次名称:" prop="batchName" class="w50p">
            <el-input v-model="formData.batchName" disabled />
          </el-form-item>
          <el-form-item label="批次号:" prop="batchNo" class="w50p">
            <el-input v-model="formData.batchNo" disabled />
          </el-form-item>
          <el-form-item label="设施名称:" prop="facilityName" class="w50p">
            <el-input
              v-for="item in formData.facilityBOList"
              :key="item.facilityNo"
              v-model="item.facilityName"
              disabled
            />
          </el-form-item>
          <el-form-item
            label="投入农资名称 :"
            prop="agriculturalMaterialName"
            class="w50p"
          >
            <el-input
              v-for="item in formData.inputsRecordBOList"
              :key="item.materialNo"
              v-model="item.materialDTO.materialName"
              disabled
            />
            <!-- <el-input
              v-model="formData.agriculturalMaterialName"
              disabled
            /> -->
          </el-form-item>
          <el-form-item label="投入量:" prop="investmentVolume" class="w50p">
            <el-input
              v-for="item in formData.inputsRecordBOList"
              :key="item.materialNo"
              v-model="item.assetQuantity"
              disabled
            >
              <template slot="append">
                {{ item.unitName }}
              </template>
            </el-input>
          </el-form-item>
          <!-- <el-form-item label="工作农机:" prop="equipmentName" class="w50p">
            <el-input v-model="formData.equipmentName" disabled />
          </el-form-item> -->
          <el-form-item label="执行人:" prop="personName" class="w50p">
            <el-input
              v-for="item in formData.personBOList"
              :key="item.personNo"
              v-model="item.name"
              disabled
            />
          </el-form-item>
          <el-form-item label="通知时间:" prop="noticeTime" class="w50p">
            <el-input v-model="formData.noticeTime" disabled />
          </el-form-item>
          <el-form-item label="执行时间:" class="w50p execdate">
            <el-input v-model="formData.execStartTime" class="w50p" disabled />
            <div style="width: 37px; text-align: center">-</div>
            <el-input v-model="formData.execEndTime" class="w50p" disabled />
          </el-form-item>
          <el-form-item v-if="formData.taskType !== '分发任务'" class="w100p">
            <h2 style="color: #000">任务处理信息</h2>
          </el-form-item>
          <el-form-item
            v-if="formData.taskType !== '分发任务'"
            label="任务处理时间: "
            class="w50p execdate"
          >
            <el-input v-model="formData.workStartTime" class="w50p" disabled />
            <div style="width: 37px; text-align: center">-</div>
            <el-input v-model="formData.workEndTime" class="w50p" disabled />
          </el-form-item>
          <el-form-item
            v-if="formData.taskType !== '分发任务'"
            label="作业面积:"
            prop="workArea"
            class="w50p"
          >
            <el-input v-model="formData.workload" disabled>
              <template slot="append">
                {{ formData.workloadUnitName }}
              </template>
            </el-input>
          </el-form-item>
          <el-form-item
            v-if="formData.taskType !== '分发任务'"
            label="完成度: "
            prop="loss"
            class="w50p"
          >
            <el-input v-model="formData.completeness" disabled />
          </el-form-item>
          <el-form-item
            v-if="formData.taskType !== '分发任务'"
            label="未完成设施: "
            prop="loss"
            class="w50p"
          >
            <el-input
              v-for="item in formData.facilityVoUnList"
              :key="item.facilityNo"
              v-model="item.facilityName"
              disabled
            />
          </el-form-item>
          <el-form-item
            v-if="formData.taskType !== '分发任务'"
            label="作业结果:"
            prop="remark"
            class="w100p"
          >
            <el-input
              v-model="formData.remark"
              autosize
              placeholder="备注"
              disabled
            />
          </el-form-item>
        </el-form>
        <!-- <span slot="footer" class="dialog-footer">
          <el-button class="zh-button-one" @click="distributeVisible = false">取 消</el-button>
          <el-button class="zh-button-two" type="primary" @click="distributeVisible = false">
            确 定
          </el-button>
        </span> -->
      </el-dialog>
      <el-dialog
        id="tableColumnDialog"
        title="配置列"
        :visible.sync="dialogTableColumnVisible"
      >
        <tableColumn
          v-if="dialogTableColumnVisible"
          ref="tableColumn"
          :tableColumn="allTableColumn"
          @cancelColumn="cancelColumn"
        />
        <div slot="footer" class="dialog-footer">
          <el-button
            class="zh-button-one"
            @click="dialogTableColumnVisible = false"
          >
            取 消
          </el-button>
          <el-button class="zh-button-two" type="primary" @click="saveColumn">
            保 存
          </el-button>
        </div>
      </el-dialog>
      <SeeEquip
        :is-show-equip="isShowEquip"
        :equip-data="facilityBOList"
        @closeDialog="isShowEquip = false"
      />
    </template>
  </BaseMainSlot>
</template>

<script>
import SelectButton from "@/components/selectbutton/index.vue";
import SearchForm from "@/components/searchForm";
import Table from "@/components/table/table.vue";
import ActionBar from "@/components/ActionBar";
import SeeEquip from "@/components/seeEquip/index.vue";
import Pagination from "@/components/Pagination";
import agriculturalRecords from "@/api/digital-production/agricultural-work-management/agricultural-records-management";
import nowstaff from "@/api/digital-operation/personnel-cost-mansge/staff-manage/index";
// import SelectButton from "../components/selcetButtonwork.vue";
// 获取下拉框
import managementtwo from "@/api/digital-production/agr-input-management/agr-input-managementtwo";
import classificat from "@/api/digital-production/agricultural-work-management/agricultural-work-classification";
import nowpagereq from "@/api/basic-info-manage/agr-source-base-Manage/index";
// import danwei from "@/api/basic-info-manage/unit-manage/index";
import userreq from "@/api/user/index";
// import nowstaff from "@/api/digital-production/basic-info-manage/staff-manage";
import BaseMainSlot from "@/components/BaseMainSlot/newBaseMainSlot.vue";
import { mymixin } from "@/utils/mixin";
import moment from "moment";
import { getToken } from "@/utils/auth";
import axios from "axios";

// import { getToken } from "@/utils/auth";
export default {
  name: "AgriculturalHistoryQuery",
  components: {
    SearchForm,
    Table,
    ActionBar,
    Pagination,
    BaseMainSlot,
    SeeEquip,
    SelectButton,
  },
  mixins: [mymixin],
  data() {
    return {
      status: 0,
      selectbutlist: [{ name: "待处理" }, { name: "已处理" }],
      tableColumn: [
        { prop: "batchName", label: "批次名称", minWidth: "140" },
        { prop: "batchNo", label: "批次号" },
        {
          prop: "facilityBOList",
          label: "设施名称",
          slotName: "facilityBOList",
        },
        {
          prop: "execStartTime",
          label: "执行时间",
          slotName: "execStartTime",
          width: "320",
        },
        { prop: "result", label: "任务状态" },
        {
          prop: "operation",
          label: "操作",
          slotName: "operation",
          width: "120",
        },
      ],
      formConfig: [
        {
          label: "选择批次",
          prop: "batchNo",
          type: "select",
          options: [],
          optionKey: { label: "batchName", value: "batchNo" },
        },
        {
          label: "选择设施",
          prop: "facilityNo",
          type: "select",
          options: [],
          optionKey: { label: "facilityName", value: "facilityNo" },
        },
        {
          label: "作业名称",
          prop: "agriculturalWorkTypeNo",
          type: "select",
          options: [],
          optionKey: {
            label: "agriculturalWorkTypeName",
            value: "agriculturalWorkTypeNo",
          },
        },
        {
          label: "农资名称",
          prop: "materialNo",
          type: "select",
          options: [],
          optionKey: { label: "materialName", value: "materialNo" },
        },
        {
          label: "执行人",
          prop: "personNo",
          type: "select",
          options: [],
          optionKey: { label: "personName", value: "personNo" },
        },
        {
          label: "选择时间",
          prop: "date",
          type: "daterange",
        },
      ],
      obj: {
        name: "",
      },
      logoImg: require("@/assets/logo.png"),
      //  标签栏相关
      activeName: "first",
      operationVisible: false,
      distributeVisible: false,
      // 投入类型列表
      inputTypeList: [],
      routeName: "",
      // 当前页
      installationName: "",
      rules: {},
      // 选中的设施id数组 ID组成
      incomeCostIdList: [],
      // 柱状图相关值
      bottomtabdat: {},
      tabtype: false,
      agriculturalWorkType: {},
      batchNo: "",
      facilityBOList: [],
      scope: "",
      // 批次名称Id
      // 设施
      facilityAList: [],
      // 设施Id
      facilityNo: "",
      // 农资
      AgriculturalList: [],
      agriculturalWorkTypeNo: "",
      // 搜索时间
      searchlist: {},
      tagsList: [],
      // 作业方式
      queryMethodList: [],
      method: "",
      unitlist: [],
      agriculturalMaterialList: [],
      materialNo: "",
      // 判断是否有农资损耗
      waste: "",
      // 人员
      staffList: [],
      personNo: undefined,
      // 承租户
      querylessesList: [],
      lessesId: undefined,
      queryEquipmentList: [],
      methodChange: true,
      inputsRecordBOList: [],
      isShowEquip: false,
      result: ["待处理", "已完成"],
    };
  },
  watch: {},
  created() {
    let year = new Date().getFullYear()
    this.searchlist.date = [new Date(year+'-01-01 00:00').getTime(), new Date(year+'-12-31 11:59').getTime()]
    // this.getdikuaidata();
    this.getqueryAllList();
    this.zhnewgetqueryAllList();
  },
  mounted() {},
  methods: {
    // 导出
    async download() {
      let params = {
        entity: {
          ...this.entity,
        },
      };
      let url = "v3/agriculturalTask/agriculturalTask/download";
      let excel = "农事任务表";
      this.downloadExcel(url, params, excel);
    },
    gettabletype(e) {
      this.formConfig[0].options = [];
      this.searchlist.batchNo = "";
      this.status = e;
      this.getBatchList();
      this.getTableDataList();
    },
    seeEquip(row) {
      console.log("a"); 
      this.facilityBOList = row.facilityBOList;
      this.isShowEquip = true;
      console.log(this.isShowEquip);
      console.log(row.facilityBOList);
    },
    // 标签栏相关方法
    // 获取表格数据
    getTableDataList() {
      this.loading = true;
      let params = {
        page: this.currentPage,
        size: this.pageSize,
        sortList: this.sortList || [],
        entity: {
          batchNo: this.searchlist.batchNo || undefined,
          farmingTypeNo: sessionStorage.farmingTypeNo,
          organizationNo: sessionStorage.organizationNo,
          agriculturalWorkTypeNo:
            this.searchlist.agriculturalWorkTypeNo || undefined,
          facilityNo: this.searchlist.facilityNo || undefined,
          employeeId: this.employeeId || undefined,
          startTime: this.searchlist.date && this.searchlist.date[0],
          endTime: this.searchlist.date && this.searchlist.date[1],
          result: this.result || undefined,
          materialNo: this.searchlist.materialNo || undefined,
          personNo: this.searchlist.personNo || undefined,
          // batchStatus: this.status,
          result: this.result[this.status],
        },
      };
      if (this.status == 0) {
        params.entity.batchStatus = this.status
      }
      this.entity = params.entity;
      agriculturalRecords.getCulturalListhavehand(params).then((res) => {
        this.loading = false;
        let data = res.data;
        // console.log(data)
        if (data) {
          this.totalSize = data.totalElements;
          this.tableData = data.content;
        } else this.tableData = [];
        this.addblankmet();
        this.resetActionBar();
      });
    },
    getBatchList() {
      let param = {
        farmingTypeNo: sessionStorage.farmingTypeNo,
        // status: this.status,
        simpleData: true
      };
      if (this.status == 0) {
        param.status = this.status
      }
      managementtwo.queryBatchList(param).then((res) => {
        this.formConfig[0].options = res.data;
      });
    },
    // 获取下拉框数据
    getqueryAllList() {
      // this.getBatchList();
      let faciparams = {};
      if (this.nowChanceStau === "add") {
        faciparams = {
          organizationList: sessionStorage
            .getItem("organizationList")
            .split(","),
          farmingTypeNo: sessionStorage.getItem("farmingTypeNo"),
          facilityStatus: 1,
        };
      } else {
        faciparams = {
          organizationList: sessionStorage
            .getItem("organizationList")
            .split(",")
            .concat([sessionStorage.parentId || ""]),
          farmingTypeNo: sessionStorage.getItem("farmingTypeNo"),
        };
      }
      userreq.getfacilityAll(faciparams).then((res) => {
        this.formConfig[1].options = res.data;
      });
      managementtwo.queryFacilityName().then((res) => {
        this.facilityAList = res.data;
      });
      nowstaff.getStaffListByCondition().then((res) => {
        this.formConfig[4].options = res.data.map((el) => {
          return { ...el, personName: el.person?.name };
        });
      });
      // 农资
      managementtwo.getqueryList().then((res) => {
        this.formConfig[3].options = res.data;
      });
      // nowpagereq.getUnitList(params).then((res) => {
      //   let data = res.data;
      //   // 赋值总条数
      //   this.totalSize = data.totalElements;
      //   // 赋值数组
      //   this.agriculturalMaterialList = data.content;
      //   console.log(this.agriculturalMaterialList,'wwwwwwwwww');
      // });
      // 获取执行人
      agriculturalRecords.getEmployeeList().then((res) => {
        let data = res.data;
        // 赋值总条数
        // 赋值总条数
        // this.totalSize = data.totalElements;
        // 赋值数组
        data.forEach((item) => {
          if (item.person !== undefined) {
            this.$set(item, "name", item.person.name);
          } else {
            this.$set(item, "name", "");
          }
        });
        this.staffList = data;
        // console.log(this.staffList)
      });
    },
    // 获取左下角可选择农事作业名称
    zhnewgetqueryAllList() {
      if (getToken("parentId")) {
        let zhurl =
          this.$baseurl.webServiceUrl +
          "productionv2/agriculturalWorkType/queryByCondition";
        let neworglist =
          JSON.parse(getToken("organizationList")) + "," + getToken("parentId");
        axios({
          headers: {
            sysDataBaseName: "DB_TDW1_SC",
            accessToken: getToken("token"),
            systemMark: "MC",
            databaseName: getToken("databaseName"),
            organizationList: neworglist,
            organizationNo: JSON.stringify(getToken("organizationNo")),
          },
          data: {
            farmingTypeNo: getToken("farmingTypeNo"),
          },
          method: "post",
          url: zhurl,
        }).then((res) => {
          let data = res.data.data;
          this.formConfig[2].options = data;
        });
      } else {
        classificat.getqueryAllList().then((res) => {
          let data = res.data;
          this.formConfig[2].options = data;
        });
      }
    },
    // 时间格式
    dateFormat(row, colnum) {
      if (this.formData.agriculturalTaskId) {
        return moment(row[colnum.property]).format("YYYY-MM-DD");
      }
    },
    // 弹出框
    async operation(row) {
      this.formData = {};
      if (row.agriculturalWorkType) {
        this.operationVisible = true;
        let facilitList = [];
        facilitList = row.facilityBOList.map((item) => item.facilityNo);
        this.formData = {
          agriculturalTaskNo: row.agriculturalTaskNo,
          agriculturalWorkTypeName:
            row.agriculturalWorkType.agriculturalWorkTypeName,
          agriculturalWorkTypeNo:
            row.agriculturalWorkType.agriculturalWorkTypeNo,
          batchNo: row.batchNo,
          batchName: row.batchName,
          facilityNoList: facilitList,
          workload: row.workload,
          workloadUnitNo: row.workloadUnitNo,
          unitNo: row.unitNo,
          noticeTime: JSON.parse(
            JSON.stringify(new Date(row.noticeTime).getTime())
          ),
          execStartTime: JSON.parse(
            JSON.stringify(new Date(row.execStartTime).getTime())
          ),
          execEndTime: JSON.parse(
            JSON.stringify(new Date(row.execEndTime).getTime())
          ),
          agriculturalTaskId: row.agriculturalTaskId,
          agriculturalWorkType: row.agriculturalWorkType,
          facilityBOList: row.facilityBOList,
          farmingTypeNo: row.farmingTypeNo,
          organizationNo: row.organizationNo,
          processEndTime: row.processEndTime,
          processStartTime: row.processStartTime,
          taskType: row.taskType,
          unitName: row.unitName,
          inputsRecordBOList: row.inputsRecordBOList,
          workloadUnitName: row.workloadUnitName,
        };
        // this.inputsRecordBOList = row.inputsRecordBOList;

        const { data: resss } = await classificat.queryInputsByNoList(
          row.agriculturalTaskNo
        );
        this.inputsRecordBOList = resss;
      }
      // console.log(this.formData)
    },
    distribute(row) {
      this.formData = {};
      if (row.agriculturalWorkTypeNo) {
        this.distributeVisible = true;
        this.formData = row;
        // this.method = row.agriculturalWorkType.method;
        // this.batchNo = row.batchNo;
      }
    },
    // TODO:
    search(searchlist) {
      this.searchlist = searchlist;
      this.currentPage = 1;
      this.getTableDataList();
    },
    changePageSize(pageSize) {
      this.pageSize = pageSize;
      this.getTableDataList();
    },
    changeCurrentPage(currentPage) {
      this.currentPage = currentPage;
      this.getTableDataList();
    },
    handleEdit(row) {
      // TODO 点击行元素后 edit
      if (row.agriculturalTaskId) {
        this.formData = row;
        // console.log(this.formData);
        this.formData.agriculturalWorkTypeName =
          row.agriculturalWorkType.agriculturalWorkTypeName;
        this.method = row.agriculturalWorkType.method;
        this.formData.batchNo = row.batchNo;
        // this.batchNo = row.batchNo;
        // this.formData.execStartTime = new Date(row.execStartTime).getTime()
        // this.formData.execEndTime = new Date(row.execStartTime).getTime()
        // console.log(this.formData.execStartTime)
        // this.formData.facilityNoList = row.facilityBOList;
        this.formData.facilityNoList = [];
        row.facilityBOList.forEach((item) => {
          this.formData.facilityNoList.push(item.facilityNo);
        });
        if (this.formData.loss > 0) {
          this.waste = "是";
        } else {
          this.waste = "否";
        }
        // console.log(this.formData.facilityNoList)
        this.editActive = true;
        this.saveActive = false;
        this.cancelActive = true;
        this.canInput = false;
      }
    },
    handleSelectionChange(list) {
      this.agriculturalTaskIdList = [];
      this.agriculturalTaskIdList = list.map((item) => item.agriculturalTaskId);
      if (this.agriculturalTaskIdList.length > 0) this.delActive = true;
      else this.delActive = false;
    },
    addPoint() {},
    cancel() {
      this.formData = {};
      // TODO 取消后 除了查看二维码外 input不可输入 add 1 其余 0
      this.canInput = false;
      this.addActive = true;
      this.editActive = false;
      this.delActive = false;
      this.saveActive = false;
      this.cancelActive = false;
    }
  },
};
</script>

<style scoped lang="scss">
.zh-search {
  // width: 100%;
  height: 100px;
  // border: #23fff8 1px solid;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-left: 20px;
  overflow: auto;
  .label-input {
    display: flex;
    align-items: center;
    .label {
      width: 100px;
      white-space: nowrap;
    }
  }
  .search {
    display: flex;
    align-items: center;
    cursor: pointer;
    img {
      height: 30px;
    }
  }
}
@import "~@/styles/variables.scss";
::v-deep .el-dialog {
  .el-dialog__header .el-dialog__title {
    color: #fff;
  }
  background-color: #005d7b;
  border: #23fff8 1px solid;
  .el-form {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: space-between;
    .el-form-item {
      display: flex;
      .el-form-item__label {
        min-width: 120px !important;
        text-align: end;
      }
      .el-input__inner {
        border: none;
      }
    }
    .execdate {
      width: 100%;
      .el-form-item__content {
        display: flex;
      }
    }
  }
}
::v-deep .common-layout {
  overflow-y: auto;
  .search-box {
    .label-input {
      margin-bottom: 10px;
      .label {
        text-align: end;
        padding-right: 10px;
      }
    }
    flex-wrap: wrap;
    .el-date-editor.el-input {
      width: 200px;
    }
    .date {
      display: flex;
      .date-ps {
        display: block;
        height: 36px;
        line-height: 36px;
        padding: 0 10px;
      }
    }
  }
  .zhcontent {
    height: calc(90% - 50px) !important;
  }
}
::v-deep .el-form-item__label {
  min-width: 160px !important;
  text-align: end;
}
.inputs-list-two {
  display: inline-flex;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  .title {
    font-size: 20px;
    font-weight: 600;
  }
  .input-item {
    display: inline-flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
    .input-item-line {
      display: inline-flex;
      align-content: center;
      align-items: center;
      margin-bottom: 10px;
      .lable {
        width: 120px;
        text-align: end;
        font-size: 16px;
        padding-right: 5px;
      }
      .value {
        width: calc(100% - 120px);
      }
    }
  }
}
::v-deep .tab-select {
  width: 100%;
  .butt-list-sty {
    position: absolute;
    left: 5px;
    top: 7px;
  }
}
</style>

